/*
 * Copyright (c) 2014 laidian. All Rights Reserved.
 * @author yaoyuming
 * @date  2019-12-04 17:02
 */
package com.yao.cloud.consumer.util;

import com.yao.cloud.consumer.helper.SpringFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.client.RestTemplate;

/**
 * 封装Ribbon的REST请求,Eureka服务
 * @author yaoyuming
 * @date 2019/12/04 17:02
 */
public class EurekaUtils {

    static String serviceId = "Eureka-Server";

    @Autowired
    private static RestTemplate restTemplate;


    public static String getServerInfo(){

        restTemplate = SpringFactory.getBean(RestTemplate.class);

        StringBuilder strBuilder = new StringBuilder();
        strBuilder.append("http://").append(serviceId).append("/server/get");
        String url = strBuilder.toString();
        return restTemplate.getForObject(url, String.class);
    }

}